﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.BufferOutput   =   false; 
        Response.Clear();   
        Response.AppendHeader("Content-Disposition", "attachment; filename=" + "91fc_net.rar");   
        Response.ContentType   =   "application/octstream";   
        Response.CacheControl   =   "Private";
        Stream stm = new FileStream(Server.MapPath("91fc_net20091029.rar"), FileMode.Open, FileAccess.Read, FileShare.Read);  
        Response.AppendHeader( "Content-length",stm.Length.ToString() );
        BinaryReader   br = new   BinaryReader(stm);

        byte[] bytes;

        for (Int64 x = 0; x < (br.BaseStream.Length / 4096 + 1); x++)
        {
            bytes = br.ReadBytes(4096);
            Response.BinaryWrite(bytes);
            System.Threading.Thread.Sleep(5);  //休息一下,防止耗用带宽太多。
        }

        stm.Close(); 


    }
	protected void Button2_Click(object sender, EventArgs e)
    {
        Response.BufferOutput   =   false; 
        Response.Clear();   
        Response.AppendHeader("Content-Disposition", "attachment; filename=" + "91fc_netall.rar");   
        Response.ContentType   =   "application/octstream";   
        Response.CacheControl   =   "Private";
        Stream stm = new FileStream(Server.MapPath("91fc_netall20091029.rar"), FileMode.Open, FileAccess.Read, FileShare.Read);  
        Response.AppendHeader( "Content-length",stm.Length.ToString() );
        BinaryReader   br = new   BinaryReader(stm);

        byte[] bytes;

        for (Int64 x = 0; x < (br.BaseStream.Length / 4096 + 1); x++)
        {
            bytes = br.ReadBytes(4096);
            Response.BinaryWrite(bytes);
            System.Threading.Thread.Sleep(5);  //休息一下,防止耗用带宽太多。
        }

        stm.Close(); 


    }
    
}
